package pr.iceworld.fernando.entity.res;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import pr.iceworld.fernando.entity.IResponseEntity;

@Data
@NoArgsConstructor
public class ResponseResult<T> implements IResponseEntity {
    public final static String STATUS_SUCCESS = "success";
    public final static String STATUS_FAIL = "fail";
    private String status;
    private String message;
    private T data;

    public static <T> ResponseResult<T> ok(T data) {
        ResponseResult webBaseResult = new ResponseResult<T>();
        webBaseResult.setData(data);
        webBaseResult.setStatus(STATUS_SUCCESS);
        return webBaseResult;
    }

    public static <T> ResponseResult<T> fail(String message) {
        ResponseResult webBaseResult = new ResponseResult<T>();
        webBaseResult.setStatus(STATUS_FAIL);
        webBaseResult.setMessage(message);
        return webBaseResult;
    }
}
